<template>
  <div id="indexPage">
    <HeadNav
      type="index"
      :show="1"
      ref="head"
      @publisherChange="publisherChange()"
      @initPage="initPage()"
      @noInitPage="noInitPage()"
    ></HeadNav>
    <div class="wd-1220">
      <!-- 数据简报 -->
      <div class="data-paper model-container">
        <div class="model-bg">
          <div class="section-title">
            数据简报
            <span class="time" v-if="show">昨日 {{ $beforeDate() }}</span>
            <span class="time" v-else
              >上周 {{ $weekDate().start }} ~ {{ $weekDate().end }}</span
            >
            <span
              class="click-font"
              style="margin-left: 15px"
              @click="change"
              v-if="dataNewPower"
              >切换</span
            >
          </div>
          <div class="content" v-if="dataNewPower">
            <div class="left">
              <div style="margin-bottom: 20px">
                <div class="data-block">
                  <div>
                    <a-icon type="line-chart" />
                    <span class="secondary-font"
                      >本社销售指数
                      <a-popover
                        placement="topLeft"
                        trigger="click"
                        :align="{ offset: [-14, 5] }"
                      >
                        <template slot="content">
                          <div style="font-size: 12px; color: #7789af">
                            基于本社品种销售码洋、册数，经系统综合计算得出的数值。<br />统计范围包含博库所有渠道的订单数据。
                          </div>
                        </template>
                        <span
                          style="
                            cursor: pointer;
                            color: #93a2bf;
                            line-height: normal;
                            font-size: 14px;
                            display: inline-block;
                            vertical-align: middle;
                          "
                        >
                          <svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-tips" />
                          </svg>
                        </span>
                      </a-popover>
                    </span>
                  </div>
                  <div class="data-font" v-if="saleTotal == 0">
                    {{ saleTotal }}
                  </div>
                  <div class="data-font" v-else>
                    {{ saleTotal ? saleTotal.toLocaleString() : "--" }}
                  </div>
                </div>
                <div class="data-block">
                  <div>
                    <a-icon type="line-chart" />
                    <span class="secondary-font">本社市场占有率</span>
                  </div>
                  <div class="data-font" v-if="saleRatio == 0">
                    {{ saleRatio.toFixed(2) }}%
                  </div>
                  <div class="data-font" v-else>
                    {{ saleRatio ? saleRatio + "%" : "--" }}
                  </div>
                </div>
                <div class="data-block">
                  <div>
                    <a-icon type="line-chart" />
                    <span class="secondary-font">本社行业排名</span>
                  </div>
                  <div class="data-font" v-if="saleRank">
                    {{ saleRank }}
                  </div>
                  <div class="data-font" v-else>--</div>
                </div>
              </div>
              <div id="container"></div>
            </div>
            <div class="right">
              <!-- 主营类目 -->
              <div class="main-category">
                <!-- 最佳类目 -->
                <div
                  class="category-content"
                  v-if="publishSummaryInfo && publishSummaryInfo.main_cate"
                >
                  <div class="category-left">最佳类目</div>
                  <div class="category-right">
                    <span class="data-tab data-tab-night">{{
                      publishSummaryInfo.main_cate.name
                        ? publishSummaryInfo.main_cate.name
                        : "--"
                    }}</span
                    >，占本社总销售的<span class="data-tab data-tab-night">{{
                      publishSummaryInfo.main_cate.ratio
                        ? publishSummaryInfo.main_cate.ratio
                        : "--"
                    }}</span
                    >，本社在该类目下排名第
                    <span class="data-tab data-tab-night">{{
                      publishSummaryInfo.main_cate.rank
                        ? publishSummaryInfo.main_cate.rank
                        : "--"
                    }}</span
                    >名
                  </div>
                </div>
                <!-- 最佳品种 -->
                <div
                  class="category-content"
                  v-if="publishSummaryInfo && publishSummaryInfo.best_rank"
                >
                  <div class="category-left">最佳品种</div>
                  <div class="category-right">
                    <div class="category-content">
                      <span
                        class="data-tab data-tab-night"
                        style="cursor: pointer"
                        @click="
                          $toDetail(publishSummaryInfo.best_rank.goods_id)
                        "
                        >{{
                          publishSummaryInfo.best_rank.goods_name
                            ? publishSummaryInfo.best_rank.goods_name
                            : "--"
                        }}</span
                      >总计销售指数
                      <!-- </div> -->
                      <!-- <div> -->
                      <span class="data-tab data-tab-night">{{
                        publishSummaryInfo.best_rank.sale_total
                          ? publishSummaryInfo.best_rank.sale_total.toLocaleString()
                          : "--"
                      }}</span
                      >点进入总榜第
                      <span class="data-tab data-tab-night">{{
                        publishSummaryInfo.best_rank.all_rank
                          ? publishSummaryInfo.best_rank.all_rank
                          : "--"
                      }}</span
                      >名，
                      <span class="data-tab data-tab-night">{{
                        publishSummaryInfo.best_rank.cate_name
                          ? publishSummaryInfo.best_rank.cate_name
                          : "--"
                      }}</span
                      >类目第
                      <span class="data-tab data-tab-night">{{
                        publishSummaryInfo.best_rank.cate_rank
                          ? publishSummaryInfo.best_rank.cate_rank
                          : "--"
                      }}</span
                      >名
                    </div>
                  </div>
                </div>
                <!-- 最高涨幅 -->
                <div
                  class="category-content"
                  v-if="publishSummaryInfo && publishSummaryInfo.best_incr"
                >
                  <div class="category-left">最高涨幅</div>
                  <div class="category-right">
                    <div class="category-content">
                      <span
                        class="data-tab data-tab-night"
                        style="cursor: pointer"
                        @click="
                          $toDetail(publishSummaryInfo.best_incr.goods_id)
                        "
                        >{{
                          publishSummaryInfo.best_incr.goods_name
                            ? publishSummaryInfo.best_incr.goods_name
                            : "--"
                        }}</span
                      >销售指数增长
                      <span class="data-tab data-tab-two">{{
                        publishSummaryInfo.best_incr.incr_amount
                          ? "+" +
                            publishSummaryInfo.best_incr.incr_amount.toLocaleString()
                          : "--"
                      }}</span
                      >，较上个周期
                      <span
                        class="data-tab data-tab-two"
                        v-if="publishSummaryInfo.best_incr.incr_rate > 0"
                        >+{{ publishSummaryInfo.best_incr.incr_rate }}%</span
                      >
                      <span
                        v-else-if="publishSummaryInfo.best_incr.incr_rate < 0"
                        class="data-tab data-tab-three"
                        >{{ publishSummaryInfo.best_incr.incr_rate }}%</span
                      >
                      <span v-else class="data-tab data-tab-two">--</span>
                      <!-- </div> -->
                      <!-- <div> -->
                    </div>
                  </div>
                </div>
                <!-- 销量异动，先注释后续可能解开 -->
                <!-- <div
                  class="category-content"
                  v-if="publishSummaryInfo && publishSummaryInfo.sale_abnormal"
                >
                  <div class="category-left">销量异动</div>
                  <div class="category-right">
                    <div class="category-content">
                      有
                      <span
                        class="data-tab data-tab-two"
                        style="cursor: pointer"
                        @click="
                          $router.push({name:'abnormal'})
                        "
                        v-if="publishSummaryInfo.sale_abnormal.incr_count >= 0"
                        >{{
                          publishSummaryInfo.sale_abnormal.incr_count
                        }}个品种</span
                      >
                      <span class="data-tab data-tab-two" v-else>--</span
                      >销量异常增长，
                      <span
                        class="data-tab data-tab-three"
                        style="cursor: pointer"
                        @click="
                          $router.push({name:'abnormal'})
                        "
                        v-if="publishSummaryInfo.sale_abnormal.decr_count >= 0"
                        >{{
                          publishSummaryInfo.sale_abnormal.decr_count
                        }}个品种</span
                      >
                      <span class="data-tab data-tab-three" v-else>--</span>
                      销量异常下降
                    </div>
                  </div>
                </div> -->
                <!-- 库存预警 -->
                <div
                  class="category-content"
                  v-if="publishSummaryInfo && publishSummaryInfo.stock_warning"
                >
                  <div class="category-left">库存预警</div>
                  <div class="category-right">
                    <div class="category-content">
                      <span class="data-tab data-tab-night" style="cursor:pointer;" @click="$router.push({name:'publishinventory',query:{inventoryType:'shortage'}})">{{
                        publishSummaryInfo.stock_warning.total
                          ? publishSummaryInfo.stock_warning.total
                          : "--"
                      }}</span
                      >个品种库存紧张，滞销品种库存码洋占总量
                      <span class="data-tab data-tab-two">{{
                        publishSummaryInfo.stock_warning.ratio
                          ? publishSummaryInfo.stock_warning.ratio
                          : "--"
                      }}</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="content" style="height: 357px; position: relative" v-else>
            <ModelNoPower
              type="noPower"
              :id="dataNewPowerID"
              :organizeId="$refs.head.publishInfo.organization_id"
            ></ModelNoPower>
          </div>
          <div class="divider"></div>
          <!-- 列表 -->
          <div class="rank-list">
            <a-row :gutter="30">
              <a-col :span="8">
                <div class="title">品种销售排行</div>
                <div v-if="dataRankPower">
                  <div class="table small" style="padding: 0; height: 303px">
                    <table style="table-layout: fixed">
                      <colgroup>
                        <col width="45" />
                        <col width="175" />
                        <col width="74" />
                        <col width="74" />
                      </colgroup>
                      <thead>
                        <tr>
                          <td>排行</td>
                          <td>品种</td>
                          <td style="text-align: right">销售指数</td>
                          <td style="text-align: right">较上周期</td>
                        </tr>
                      </thead>
                      <tbody v-if="allGoodsRank.length > 0">
                        <tr v-for="(item, index) in allGoodsRank" :key="index">
                          <td style="text-align: center">
                            {{ item.sale_rank }}
                          </td>
                          <td>
                            <div class="goods-desc">
                              <span
                                class="goods-image small"
                                v-if="item.cover_pic"
                              >
                                <img
                                  :src="item.cover_pic"
                                  alt
                                  style="width: 32px; height: 32px"
                                />
                                <div
                                  class="goods-logo prev"
                                  v-if="item.is_presale == 1"
                                >
                                  预
                                </div>
                                <div
                                  class="goods-logo group"
                                  v-else-if="item.have_presale == 1"
                                >
                                  组
                                </div>
                              </span>
                              <span
                                v-else
                                class="no-pic"
                                style="min-width: 32px; min-height: 32px"
                              ></span>
                              <span
                                class="click-font goods-sname"
                                :title="item.goods_name"
                                style="width: 127px"
                                @click="$toDetail(item.goods_id)"
                                >{{ item.goods_name }}</span
                              >
                            </div>
                          </td>
                          <td style="text-align: right">
                            {{ item.sale_total.toLocaleString() }}
                          </td>
                          <td style="text-align: right">
                            <span class="percent" v-if="item.compare_rate > 0"
                              >+{{ item.compare_rate }}%</span
                            >
                            <span
                              class="green"
                              v-else-if="item.compare_rate <= 0"
                              >{{ item.compare_rate }}%</span
                            >
                            <span v-else>--</span>
                          </td>
                        </tr>
                      </tbody>
                      <tbody v-else>
                        <tr>
                          <td colspan="4">
                            <div style="margin-top: 50px">
                              <a-empty />
                            </div>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                  <div style="text-align: center">
                    <span
                      class="click-font"
                      @click="
                        $router.push({
                          name: 'taopu100',
                          query: { sort: 'rank_supplier' },
                        })
                      "
                      >前往完整排行</span
                    >
                  </div>
                </div>
                <div style="height: 321px" v-else>
                  <ModelNoPower
                    type="noPower"
                    :id="dataRankPowerID"
                    :organizeId="$refs.head.publishInfo.organization_id"
                  ></ModelNoPower>
                </div>
              </a-col>
              <a-col :span="8">
                <div class="title">品种涨幅排行</div>
                <div v-if="dataRankPower">
                  <div class="table small" style="padding: 0; height: 303px">
                    <table style="table-layout: fixed">
                      <colgroup>
                        <col width="45" />
                        <col width="175" />
                        <col width="74" />
                        <col width="74" />
                      </colgroup>
                      <thead>
                        <tr>
                          <td>排行</td>
                          <td>品种</td>
                          <td style="text-align: right">销售指数</td>
                          <td style="text-align: right">较上周期</td>
                        </tr>
                      </thead>
                      <tbody v-if="allUpRank.length > 0">
                        <tr v-for="(item, index) in allUpRank" :key="index">
                          <td style="text-align: center">
                            {{ item.sale_rank }}
                          </td>
                          <td>
                            <div class="goods-desc">
                              <span
                                class="goods-image small"
                                v-if="item.cover_pic"
                              >
                                <img
                                  :src="item.cover_pic"
                                  alt
                                  style="width: 32px; height: 32px"
                                />
                                <div
                                  class="goods-logo prev"
                                  v-if="item.is_presale == 1"
                                >
                                  预
                                </div>
                                <div
                                  class="goods-logo group"
                                  v-else-if="item.have_presale == 1"
                                >
                                  组
                                </div>
                              </span>
                              <span
                                v-else
                                class="no-pic"
                                style="min-width: 32px; min-height: 32px"
                              ></span>
                              <span
                                class="click-font goods-sname"
                                :title="item.goods_name"
                                style="width: 127px"
                                @click="$toDetail(item.goods_id)"
                                >{{ item.goods_name }}</span
                              >
                            </div>
                          </td>
                          <td style="text-align: right">
                            {{ item.sale_total.toLocaleString() }}
                          </td>
                          <td style="text-align: right">
                            <span class="percent" v-if="item.compare_rate > 0"
                              >+{{ item.compare_rate }}%</span
                            >
                            <span
                              class="green"
                              v-else-if="item.compare_rate <= 0"
                              >{{ item.compare_rate }}%</span
                            >
                            <span v-else>--</span>
                          </td>
                        </tr>
                      </tbody>
                      <tbody v-else>
                        <tr>
                          <td colspan="4">
                            <div style="margin-top: 50px">
                              <a-empty />
                            </div>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                  <div style="text-align: center">
                    <span
                      class="click-font"
                      @click="
                        $router.push({
                          name: 'taopu100',
                          query: { sort: 'rank_incr_supplier' },
                        })
                      "
                      >前往完整排行</span
                    >
                  </div>
                </div>
                <div style="height: 321px" v-else>
                  <ModelNoPower
                    type="noPower"
                    :id="dataRankPowerID"
                    :organizeId="$refs.head.publishInfo.organization_id"
                  ></ModelNoPower>
                </div>
              </a-col>
              <a-col :span="8">
                <div class="title">新品销售排行</div>
                <div v-if="dataRankPower">
                  <div class="table small" style="padding: 0; height: 303px">
                    <table style="table-layout: fixed">
                      <colgroup>
                        <col width="45" />
                        <col width="175" />
                        <col width="74" />
                        <col width="74" />
                      </colgroup>
                      <thead>
                        <tr>
                          <td>排行</td>
                          <td>品种</td>
                          <td style="text-align: right">销售指数</td>
                          <td style="text-align: right">上市时长</td>
                        </tr>
                      </thead>
                      <tbody v-if="newGoodsRank.length > 0">
                        <tr v-for="(item, index) in newGoodsRank" :key="index">
                          <td style="text-align: center">
                            {{ item.sale_rank }}
                          </td>
                          <td>
                            <div class="goods-desc">
                              <span
                                class="goods-image small"
                                v-if="item.cover_pic"
                              >
                                <img
                                  :src="item.cover_pic"
                                  alt
                                  style="width: 32px; height: 32px"
                                />
                                <div
                                  class="goods-logo prev"
                                  v-if="item.is_presale == 1"
                                >
                                  预
                                </div>
                                <div
                                  class="goods-logo group"
                                  v-else-if="item.have_presale == 1"
                                >
                                  组
                                </div>
                              </span>
                              <span
                                v-else
                                class="no-pic"
                                style="min-width: 32px; min-height: 32px"
                              ></span>
                              <span
                                class="click-font goods-sname"
                                :title="item.goods_name"
                                style="width: 127px"
                                @click="$toDetail(item.goods_id)"
                                >{{ item.goods_name }}</span
                              >
                            </div>
                          </td>
                          <td style="text-align: right">
                            {{ item.sale_total.toLocaleString() }}
                          </td>
                          <td style="text-align: right">
                            <span v-if="item.onsale_days > 0"
                              >{{ item.onsale_days }}个月</span
                            >
                            <span v-else-if="item.onsale_days == 0"
                              >预售中</span
                            >
                            <span v-else>--</span>
                          </td>
                        </tr>
                      </tbody>
                      <tbody v-else>
                        <tr>
                          <td colspan="4">
                            <div style="margin-top: 50px">
                              <a-empty />
                            </div>
                          </td>
                        </tr>
                      </tbody>
                    </table>
                  </div>
                  <div style="text-align: center">
                    <span
                      class="click-font"
                      @click="
                        $router.push({
                          name: 'taopu100',
                          query: { sort: 'rank_new_supplier' },
                        })
                      "
                      >前往完整排行</span
                    >
                  </div>
                </div>
                <div style="height: 321px" v-else>
                  <ModelNoPower
                    type="noPower"
                    :id="dataRankPowerID"
                    :organizeId="$refs.head.publishInfo.organization_id"
                  ></ModelNoPower>
                </div>
              </a-col>
            </a-row>
          </div>
        </div>
      </div>
      <!-- 实时数据 -->
      <div class="model-container">
        <div class="model-bg">
          <div class="section-title">今日实时数据</div>
          <div class="real-data">
            <div v-if="measurePower" class="clearfix">
              <div style="padding: 20px" class="float-left">
                <div
                  class="real-data-block float-left"
                  :class="{ active: measureType == 0 }"
                  @click="changeMeasure(0)"
                >
                  <div>
                    <a-icon type="line-chart" />
                    <span class="secondary-font">本社实时码洋</span>
                  </div>
                  <div class="data-font">
                    {{ publishData.today.toLocaleString() }}
                  </div>
                  <div class="before clearfix" style="width: 170px">
                    <!-- <span class="float-left">昨日全天</span>
                    <span class="num float-right">{{
                      publishData.yesterday.toLocaleString()
                    }}</span> -->
                  </div>
                  <div class="before clearfix" style="width: 170px">
                    <span class="float-left">同时段对比</span>
                    <span
                      class="num red float-right"
                      v-if="publishData.compare_rate > 0"
                      >+{{ publishData.compare_rate }}%</span
                    >
                    <span
                      class="num green float-right"
                      v-else-if="publishData.compare_rate <= 0"
                      >{{ publishData.compare_rate }}%</span
                    >
                    <span class="num float-right" v-else>--</span>
                  </div>
                </div>
                <div
                  class="real-data-block float-left"
                  :class="{ active: measureType == 1 }"
                  @click="changeMeasure(1)"
                >
                  <div>
                    <a-icon type="line-chart" />
                    <span class="secondary-font">大盘销售指数</span>
                  </div>
                  <div class="data-font">
                    {{ allData.today.toLocaleString() }}
                  </div>
                  <div class="before clearfix" style="width: 170px">
                    <!-- <span class="float-left">昨日全天</span>
                    <span class="num float-right">{{
                      allData.yesterday.toLocaleString()
                    }}</span> -->
                  </div>
                  <div class="before clearfix" style="width: 170px">
                    <span class="float-left">同时段对比</span>
                    <span
                      class="num red float-right"
                      v-if="allData.compare_rate > 0"
                      >+{{ allData.compare_rate }}%</span
                    >
                    <span
                      class="num green float-right"
                      v-else-if="allData.compare_rate <= 0"
                      >{{ allData.compare_rate }}%</span
                    >
                    <span class="num float-right" v-else>--</span>
                  </div>
                </div>
              </div>
              <div class="float-right" style="padding: 20px 15px 20px 0">
                <div
                  id="measure"
                  v-show="measureType == 0"
                  style="width: 594px"
                ></div>
                <div
                  id="measure1"
                  v-show="measureType == 1"
                  style="width: 594px"
                ></div>
              </div>
            </div>
            <div
              class="content"
              style="height: 168px; position: relative"
              v-else
            >
              <ModelNoPower
                type="noPower"
                :id="measurePowerID"
                :organizeId="$refs.head.publishInfo.organization_id"
              ></ModelNoPower>
            </div>
          </div>
        </div>
      </div>
      <div class="model-container">
        <!-- 库存分析 -->
        <a-row :gutter="10">
          <a-col :span="8">
            <div class="model-bg stock-content">
              <div class="section-title clearfix">
                <span class="float-left">本社库存分析</span>
                <span
                  class="click-font float-right"
                  @click="$router.push({ name: 'publishinventory' })"
                  >前往库存分析</span
                >
              </div>
              <div
                class="clearfix"
                style="height: 180px; padding: 10px 15px"
                v-if="stockPower"
              >
                <div class="float-left" id="ring" style="width: 180px"></div>
                <div class="float-right" style="width: 180px">
                  <div
                    class="stock-list"
                    v-for="(item, index) in ringData"
                    :key="index"
                  >
                    <div>
                      <span class="ico">
                        <svg class="icon" aria-hidden="true">
                          <use xlink:href="#icon-stock" />
                        </svg>
                      </span>
                      {{ item.name }}
                    </div>
                    <div class="stock-num">{{ item.value }}</div>
                  </div>
                </div>
              </div>
              <div style="height: 180px" v-else>
                <ModelNoPower
                  type="noPower"
                  :id="stockPowerID"
                  :organizeId="$refs.head.publishInfo.organization_id"
                ></ModelNoPower>
              </div>
            </div>
          </a-col>
          <!-- 行业大盘 -->
          <a-col :span="8">
            <div class="model-bg industry-data">
              <div class="section-title clearfix">
                <span class="float-left">行业大盘</span>
                <span
                  class="click-font float-right"
                  @click="$router.push({ name: 'industrymarket' })"
                  >前往行业大盘</span
                >
              </div>
              <div
                style="height: 180px; padding: 10px 15px"
                v-if="industryPower"
              >
                <div>
                  <div class="data-block">
                    <div>
                      <a-icon type="line-chart" />
                      <span class="secondary-font"
                        >{{ industryInfo.pre.month }}月总指数</span
                      >
                    </div>
                    <div class="data-font" v-if="industryInfo.pre.sale_amount">
                      {{ industryInfo.pre.sale_amount.toLocaleString() }}
                    </div>
                    <div class="data-font" v-else>--</div>
                  </div>
                  <div class="data-block">
                    <div>
                      <a-icon type="line-chart" />
                      <span class="secondary-font"
                        >{{ industryInfo.current.month }}月总指数</span
                      >
                    </div>
                    <div
                      class="data-font"
                      v-if="industryInfo.current.sale_amount"
                    >
                      {{ industryInfo.current.sale_amount.toLocaleString() }}
                    </div>
                    <div class="data-font" v-else>--</div>
                  </div>
                </div>
                <div class="clearfix">
                  <div class="float-left" style="width: 175px">
                    <div
                      class="industry-list clearfix"
                      v-for="(item, index) in industryInfo.pre.top_cate_list"
                      :key="index"
                    >
                      <div class="float-left industry-name">
                        {{ item.name }}
                      </div>
                      <div class="float-right">
                        {{ item.ratio ? item.ratio : "--" }}
                      </div>
                    </div>
                  </div>
                  <div class="float-right" style="width: 175px">
                    <div
                      class="industry-list clearfix"
                      v-for="(item, index) in industryInfo.current
                        .top_cate_list"
                      :key="index"
                    >
                      <div class="float-left industry-name">
                        {{ item.name }}
                      </div>
                      <div class="float-right">
                        {{ item.ratio ? item.ratio : "--" }}
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div style="height: 180px" v-else>
                <ModelNoPower
                  type="noPower"
                  :id="industryPowerID"
                  :organizeId="$refs.head.publishInfo.organization_id"
                ></ModelNoPower>
              </div>
            </div>
          </a-col>
          <!-- 竞社分析 -->
          <a-col :span="8">
            <div class="model-bg compete-data">
              <div class="section-title clearfix">
                <span class="float-left">竞社分析</span>
                <span
                  class="click-font float-right"
                  @click="$router.push({ name: 'publishmonitor' })"
                  >前往竞社数据</span
                >
              </div>
              <div
                style="height: 180px; padding: 10px 15px"
                v-if="competePower"
              >
                <div v-if="Object.keys(competeInfo).length > 0">
                  <div class="compete-name">
                    <span class="ico" @click="copyName">
                      <svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-fuzhi" />
                      </svg>
                    </span>
                    {{ competeInfo.compete_publisher_name }}
                  </div>
                  <div class="clearfix" style="margin-top: 5px">
                    <div class="float-left">
                      <div class="compete-list clearfix">
                        <div class="float-left">销售指数</div>
                        <div class="float-right compete-num">
                          {{ competeInfo.sale_total.toLocaleString() }}
                        </div>
                      </div>
                      <div class="compete-list clearfix">
                        <div class="float-left">市场占有率</div>
                        <div class="float-right compete-num">
                          {{ competeInfo.sale_ratio }}
                        </div>
                      </div>
                      <div class="compete-list clearfix">
                        <div class="float-left">行业排名</div>
                        <div class="float-right compete-num">
                          {{ competeInfo.sale_rank }}
                        </div>
                      </div>
                      <div class="compete-list clearfix">
                        <div class="float-left">
                          {{ competeInfo.main_cate_name }}类目排名
                        </div>
                        <div class="float-right compete-num">
                          {{ competeInfo.main_cate_rank }}
                        </div>
                      </div>
                    </div>
                    <div class="float-right">
                      <div class="table small" style="padding: 0">
                        <table style="table-layout: fixed">
                          <colgroup>
                            <col width="132" />
                            <col width="60" />
                          </colgroup>
                          <tbody>
                            <tr
                              v-for="(
                                item, index
                              ) in competeInfo.goods_rank_list"
                              :key="index"
                            >
                              <td
                                style="padding: 5px"
                                :style="index == 0 ? 'border-top:none;' : ''"
                              >
                                <div class="goods-desc">
                                  <span
                                    class="goods-image small"
                                    v-if="item.cover_pic"
                                  >
                                    <img
                                      :src="item.cover_pic"
                                      alt
                                      style="width: 32px; height: 32px"
                                    />
                                    <div
                                      class="goods-logo prev"
                                      v-if="item.is_presale == 1"
                                    >
                                      预
                                    </div>
                                    <div
                                      class="goods-logo group"
                                      v-else-if="item.have_presale == 1"
                                    >
                                      组
                                    </div>
                                  </span>
                                  <span
                                    v-else
                                    class="no-pic"
                                    style="min-width: 32px; min-height: 32px"
                                  ></span>
                                  <span
                                    class="click-font goods-sname"
                                    :title="item.goods_name"
                                    style="width: 90px"
                                    @click="$toDetail(item.goods_id)"
                                    >{{ item.goods_name }}</span
                                  >
                                </div>
                              </td>
                              <td
                                style="text-align: right"
                                :style="index == 0 ? 'border-top:none;' : ''"
                              >
                                {{ item.sale_total.toLocaleString() }}
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </div>
                  </div>
                </div>
                <div v-else>
                  <a-empty />
                </div>
              </div>
              <div style="height: 180px" v-else>
                <ModelNoPower
                  type="noPower"
                  :id="competePowerID"
                  :organizeId="$refs.head.publishInfo.organization_id"
                ></ModelNoPower>
              </div>
            </div>
          </a-col>
        </a-row>
      </div>
    </div>
    <Loading ref="load" :show="1" :isLoading="isLoading"></Loading>
    <!-- 更新记录弹层 -->
    <a-modal
      v-model="recordModal"
      width="600px"
      :title="'更新说明' + recordObj.version_num"
      @cancel="updateRecord"
    >
      <template slot="footer">
        <a-button key="submit" type="primary" @click="updateRecord"
          >好的</a-button
        >
      </template>
      <div class="popup" style="padding: 24px; font-size: 13px; color: #07193f">
        <div v-html="recordObj.version_desc"></div>
      </div>
    </a-modal>
  </div>
</template>
<style scoped lang="scss" src="@/style/scss/pages/index.scss"></style>
<script>
import {
  INDEX_PUBLISHERINFO,
  INDEX_RANKS,
  INDEX_COMPETE,
  INDEX_REALTIME,
  EVENT_RECENT,
  INDEX_STOCK,
  INDEX_INDUSTRY,
} from "../apis/index.js";
import { Chart, registerShape } from "@antv/g2";
import DataSet from "@antv/data-set";
export default {
  data() {
    return {
      show: false,
      changeChart: null,
      data: [],
      beforeData: [],
      saleRank: 0,
      saleRatio: 0,
      saleTotal: 0,
      publishSummaryInfo: {
        main_cate: {
          name: "",
          ratio: "",
          rank: 0,
        },
        best_rank: {
          goods_name: "",
          sale_total: 0,
          all_rank: 0,
          cate_name: "",
          cate_rank: 0,
          goods_id: 0,
        },
        best_incr: {
          goods_name: "",
          incr_amount: 0,
          incr_rate: "",
          goods_id: 0,
        },
        stock_warning: {
          total: 0,
          ratio: "0",
        },
        sale_abnormal: {
          incr_count: 0,
          decr_count: 0,
        },
      },
      // 全品种销售排行
      allGoodsRank: [],
      // 涨幅排行
      allUpRank: [],
      // 新品排行
      newGoodsRank: [],
      // 出版社top排行
      publishTopList: [],
      // 竞社监控
      competeInfo: {},
      // 行业大盘
      industryInfo: {
        pre: {
          month: "",
        },
        current: {
          month: "",
        },
      },
      // 接口权限
      dataNewPower: true,
      dataRankPower: true,
      competePower: true,
      measurePower: true,
      recentPower: true,
      stockPower: true,
      industryPower: true,
      // 权限ID
      dataNewPowerID: 0,
      dataRankPowerID: 0,
      competePowerID: 0,
      measurePowerID: 0,
      recentPowerID: 0,
      stockPowerID: 0,
      industryPowerID: 0,
      ringData: [],
      ringChange: null,
      measureData: [],
      measureChart: null,
      measureChart1: null,
      publishMeasure: [],
      allMeasure: [],
      publishData: {
        today: 0,
        yesterday: 0,
        compare_rate: 0,
      },
      allData: {
        today: 0,
        yesterday: 0,
        compare_rate: 0,
      },
      intervalId: null,
      measureType: 0,
      recentList: [],
      isLoading: true,
      recordModal: false,
      recordObj: {
        version_id: 0, // 版本id
        version_num: "", // 版本号
        version_desc: "", // 版本说明
        enable_date: "", // 版本生效时间
      },
    };
  },
  mounted() {},
  destroyed() {
    this.clear();
  },
  methods: {
    // 获取数据简报
    async getData() {
      var tStamp = this.$getTimeStamp();
      let data = {
        organization_id: this.$refs.head.publishInfo.organization_id,
        supplier_id: this.$refs.head.publishInfo.supplier_id,
        period: this.show
          ? this.$beforeDate().replace(/-/g, "")
          : this.$weekDate().weekth,
        date_type: this.show ? 1 : 2,
        start_date: this.show
          ? this.$beforeDate().replace(/-/g, "")
          : this.$weekDate().start.replace(/-/g, ""),
        timestamp: tStamp,
      };
      data.sign = this.$getSign(data);
      let res = await INDEX_PUBLISHERINFO(data);
      if (res.code == 0) {
        this.dataNewPower = true;
        let _this = this;
        this.data = res.data.sale_total_list.reverse();
        this.$nextTick(() => {
          if (_this.changeChart) {
            _this.changeChart.destroy();
            _this.initData();
          } else {
            _this.initData();
          }
          _this.isLoading = false;
        });
        this.publishSummaryInfo = res.data.supplier_summary_info;
        if (res.data.supplier_info.sale_rank) {
          this.saleRank = res.data.supplier_info.sale_rank;
        } else {
          this.saleRank = 0;
        }
        if (res.data.supplier_info.sale_ratio) {
          this.saleRatio = res.data.supplier_info.sale_ratio;
        } else {
          this.saleRatio = 0;
        }
        if (res.data.supplier_info.sale_total) {
          this.saleTotal = res.data.supplier_info.sale_total;
        } else {
          this.saleTotal = 0;
        }
        if (
          Object.keys(this.publishSummaryInfo).length > 0 &&
          this.publishSummaryInfo.best_incr.incr_rate
        ) {
          this.publishSummaryInfo.best_incr.incr_rate = Number(
            this.publishSummaryInfo.best_incr.incr_rate.replace(/%/, "")
          );
        }
      } else {
        this.isLoading = false;
        if (res.code == 1009) {
          this.dataNewPower = false;
          this.dataNewPowerID = res.data;
        } else {
          this.$refs.head.globalTip(1, res.message, res.code);
        }
      }
    },
    // 获取排行数据
    async getRankData() {
      var tStamp = this.$getTimeStamp();
      let data = {
        organization_id: this.$refs.head.publishInfo.organization_id,
        supplier_id: this.$refs.head.publishInfo.supplier_id,
        period: this.show
          ? this.$beforeDate().replace(/-/g, "")
          : this.$weekDate().weekth,
        date_type: this.show ? 1 : 2,
        start_date: this.show
          ? this.$beforeDate().replace(/-/g, "")
          : this.$weekDate().start.replace(/-/g, ""),
        timestamp: tStamp,
      };
      data.sign = this.$getSign(data);
      let res = await INDEX_RANKS(data);
      if (res.code == 0) {
        this.dataRankPower = true;
        this.allGoodsRank = [];
        this.allUpRank = [];
        this.newGoodsRank = [];
        this.publishTopList = [];
        if (res.data.rank_all) {
          this.allGoodsRank = res.data.rank_all.slice(0, 5);
        }
        if (res.data.rank_incr) {
          this.allUpRank = res.data.rank_incr.slice(0, 5);
        }
        if (res.data.rank_new) {
          this.newGoodsRank = res.data.rank_new.slice(0, 5);
        }
        if (res.data.supplier_ranks) {
          this.publishTopList = res.data.supplier_ranks.slice(0, 5);
        }
        this.$nextTick(() => {
          this.isLoading = false;
        });
      } else {
        this.isLoading = false;
        if (res.code == 1009) {
          this.dataRankPower = false;
          this.dataRankPowerID = res.data;
        } else {
          this.$refs.head.globalTip(1, res.message, res.code);
        }
      }
    },
    // 获取竞社数据
    async getCompeteData() {
      var tStamp = this.$getTimeStamp();
      let data = {
        organization_id: this.$refs.head.publishInfo.organization_id,
        supplier_id: this.$refs.head.publishInfo.supplier_id,
        timestamp: tStamp,
      };
      data.sign = this.$getSign(data);
      let res = await INDEX_COMPETE(data);
      if (res.code == 0) {
        this.competePower = true;
        this.competeInfo = {};
        if (Object.keys(res.data).length > 0) {
          this.competeInfo = res.data;
        }
        this.$nextTick(() => {
          this.isLoading = false;
        });
      } else {
        this.isLoading = false;
        if (res.code == 1009) {
          this.competePower = false;
          this.competePowerID = res.data;
        } else {
          this.$refs.head.globalTip(1, res.message, res.code);
        }
      }
    },
    // 获取行业大盘数据
    async getIndustryData() {
      var tStamp = this.$getTimeStamp();
      let data = {
        organization_id: this.$refs.head.publishInfo.organization_id,
        supplier_id: this.$refs.head.publishInfo.supplier_id,
        timestamp: tStamp,
      };
      data.sign = this.$getSign(data);
      let res = await INDEX_INDUSTRY(data);
      if (res.code == 0) {
        this.industryPower = true;
        this.industryInfo = {};
        if (Object.keys(res.data).length > 0) {
          this.industryInfo = res.data;
        }
        this.$nextTick(() => {
          this.isLoading = false;
        });
      } else {
        this.isLoading = false;
        if (res.code == 1009) {
          this.industryPower = false;
          this.industryPowerID = res.data;
        } else {
          this.$refs.head.globalTip(1, res.message, res.code);
        }
      }
    },
    // 实时数据获取
    async getMeasureData() {
      var tStamp = this.$getTimeStamp();
      let data = {
        organization_id: this.$refs.head.publishInfo.organization_id,
        supplier_id: this.$refs.head.publishInfo.supplier_id,
        timestamp: tStamp,
      };
      data.sign = this.$getSign(data);
      let res = await INDEX_REALTIME(data);
      if (res.code == 0) {
        this.dataRefreh();
        this.measurePower = true;
        this.publishData.today = res.data.supplier.today.total;
        this.publishData.yesterday = res.data.supplier.yesterday.total;
        this.allData.today = res.data.all.today.total;
        this.allData.yesterday = res.data.all.yesterday.total;
        this.publishData.compare_rate = res.data.supplier.compare_rate;
        this.allData.compare_rate = res.data.all.compare_rate;
        this.publishMeasure = [];
        this.allMeasure = [];
        res.data.supplier.yesterday.chart_data.map((value, key) => {
          let _obj = {};
          _obj.time = value.time;
          _obj.昨日 = value.value;
          this.publishMeasure.push(_obj);
        });
        res.data.supplier.today.chart_data.map((value, key) => {
          this.publishMeasure[key].今日 = value.value;
        });
        res.data.all.yesterday.chart_data.map((value, key) => {
          let _obj = {};
          _obj.time = value.time;
          _obj.昨日 = value.value;
          this.allMeasure.push(_obj);
        });
        res.data.all.today.chart_data.map((value, key) => {
          this.allMeasure[key].今日 = value.value;
        });
        let _this = this;
        this.$nextTick(() => {
          if(_this.measureChart){
            _this.measureChart.destroy();
            _this.initMeasure('publish');
          }else{
            _this.initMeasure('publish');
          }
          if(_this.measureChart1){
            _this.measureChart1.destroy();
            _this.initMeasure('all');
          }else{
            _this.initMeasure('all');
          }
          _this.isLoading = false;
        });
      } else {
        this.isLoading = false;
        if (res.code == 1009) {
          this.measurePower = false;
          this.measurePowerID = res.data;
        } else {
          this.$refs.head.globalTip(1, res.message, res.code);
        }
      }
    },
    // 获取库存分析
    async getStockData() {
      var tStamp = this.$getTimeStamp();
      let data = {
        organization_id: this.$refs.head.publishInfo.organization_id,
        supplier_id: this.$refs.head.publishInfo.supplier_id,
        timestamp: tStamp,
      };
      data.sign = this.$getSign(data);
      let res = await INDEX_STOCK(data);
      if (res.code == 0) {
        this.stockPower = true;
        this.ringData = [];
        if (Object.keys(res.data).length > 0) {
          for (let i in res.data) {
            if (i !== "all") {
              let _obj = {};
              _obj.value = res.data[i];
              if (i == "sold_out") {
                _obj.name = "已售罄品种数";
              } else if (i == "shortage") {
                _obj.name = "库存紧缺品种数";
              } else if (i == "normal") {
                _obj.name = "库存正常品种数";
              } else if (i == "surplus") {
                _obj.name = "库存富余品种数";
              } else if (i == "unsalable") {
                _obj.name = "库存积压品种数";
              }
              this.ringData.push(_obj);
            }
          }
        }
        if (this.ringData.length > 0) {
          this.$nextTick(() => {
            if (this.ringChange) {
              this.ringChange.destroy();
              this.initRing();
            } else {
              this.initRing();
            }
            this.isLoading = false;
          });
        }
      } else {
        this.isLoading = false;
        if (res.code == 1009) {
          this.stockPower = false;
          this.stockPowerID = res.data;
        } else {
          this.$refs.head.globalTip(1, res.message, res.code);
        }
      }
    },
    // 获取临期事件
    async getRecentData() {
      var tStamp = this.$getTimeStamp();
      let data = {
        organization_id: this.$refs.head.publishInfo.organization_id,
        timestamp: tStamp,
      };
      data.sign = this.$getSign(data);
      let res = await EVENT_RECENT(data);
      if (res.code == 0) {
        this.recentPower = true;
        this.recentList = [];
        this.recentList = res.data;
      } else {
        if (res.code == 1009) {
          this.recentPower = false;
          this.recentPowerID = res.data;
        } else {
          this.$refs.head.globalTip(1, res.message, res.code);
        }
      }
    },
    // 改变昨日和上周状态
    change() {
      this.show ? (this.show = false) : (this.show = true);
      this.isLoading = true;
      this.getData();
      this.getRankData();
    },
    // 实时数据切换
    changeMeasure(_type) {
      this.measureType = _type;
    },
    // 柱状图
    initData() {
      let _this = this;
      this.changeChart = new Chart({
        container: "container",
        autoFit: true,
        autoHide: false,
        height: 160,
        appendPadding: [0, 5, 0, 0],
      });
      this.changeChart.data(this.data);
      this.changeChart.scale("value", {
        alias: "本社销售：",
        nice: true,
      });

      this.changeChart.axis("date", {
        tickLine: null,
        label: {
          formatter: function (value) {
            // console.log(value)
            if (
              value == _this.data[0].date ||
              value == _this.data[2].date ||
              value == _this.data[4].date ||
              value == _this.data[6].date ||
              value == _this.data[8].date ||
              value == _this.data[10].date ||
              value == _this.data[12].date ||
              value == _this.data[14].date ||
              value == _this.data[16].date ||
              value == _this.data[18].date ||
              value == _this.data[20].date
            ) {
              return value;
            } else {
              return "";
            }
          },
          autoHide: false | true,
          autoRotate: false,
        },
      });
      this.changeChart.tooltip({
        showMarkers: false,
      });
      this.changeChart.interaction("active-region");
      this.changeChart
        .interval()
        .position("date*value")
        .style("date", (val) => {
          let _date1, _date2, _date3, _date4, _date5, _date6, _date7;
          if (_this.show) {
            _date1 = _this.$beforeDate().substring(5);
          } else {
            _date1 = _this.$weekDate().start.substring(5);
            _date2 = _this
              .$moment(_this.$weekDate().start)
              .day(2)
              .format("YYYY-MM-DD")
              .substring(5);
            _date3 = _this
              .$moment(_this.$weekDate().start)
              .day(3)
              .format("YYYY-MM-DD")
              .substring(5);
            _date4 = _this
              .$moment(_this.$weekDate().start)
              .day(4)
              .format("YYYY-MM-DD")
              .substring(5);
            _date5 = _this
              .$moment(_this.$weekDate().start)
              .day(5)
              .format("YYYY-MM-DD")
              .substring(5);
            _date6 = _this
              .$moment(_this.$weekDate().start)
              .day(6)
              .format("YYYY-MM-DD")
              .substring(5);
            _date7 = _this
              .$moment(_this.$weekDate().start)
              .day(7)
              .format("YYYY-MM-DD")
              .substring(5);
          }
          // console.log(val)
          if (
            val == _date1 ||
            val == _date2 ||
            val == _date3 ||
            val == _date4 ||
            val == _date5 ||
            val == _date6 ||
            val == _date7
          ) {
            return {
              fillOpacity: 1,
              lineWidth: 0,
              stroke: "#437AE7",
              fill: "#FF9900",
            };
          }
        })
        .size(20);
      this.changeChart.render();
    },
    // 库存分析环形图
    initRing() {
      // 可以通过调整这个数值控制分割空白处的间距，0-1 之间的数值
      const sliceNumber = 0.003;
      // 自定义 other 的图形，增加两条线
      registerShape("interval", "slice-shape", {
        draw(cfg, container) {
          const points = cfg.points;
          let path = [];
          path.push(["M", points[0].x, points[0].y]);
          path.push(["L", points[1].x, points[1].y - sliceNumber]);
          path.push(["L", points[2].x, points[2].y - sliceNumber]);
          path.push(["L", points[3].x, points[3].y]);
          path.push("Z");
          path = this.parsePath(path);
          return container.addShape("path", {
            attrs: {
              fill: cfg.color,
              path,
            },
          });
        },
      });

      this.ringChange = new Chart({
        container: "ring",
        autoFit: true,
        height: 160,
      });

      this.ringChange.data(this.ringData);
      this.ringChange.coordinate("theta", {
        radius: 0.75,
        innerRadius: 0.7,
      });
      this.ringChange.tooltip(false);
      this.ringChange.legend(false);
      this.ringChange
        .interval()
        .adjust("stack")
        .position("value")
        .color("name", (name) => {
          if (name == this.ringData[0].name) {
            return "#2959A7";
          } else if (name == this.ringData[1].name) {
            return "#5573B7";
          } else if (name == this.ringData[2].name) {
            return "#5C89C6";
          } else if (name == this.ringData[3].name) {
            return "#8FC6EC";
          } else if (name == this.ringData[4].name) {
            return "#C4E5EA";
          }
        })
        .shape("slice-shape");
      this.ringChange.render();
    },
    // 实时折线面积图
    initMeasure(type) {
      let chart,measureChartDv;
      if(type == 'publish'){
        measureChartDv = new DataSet.DataView().source(this.publishMeasure);
        chart = new Chart({
          container: "measure",
          autoFit: true,
          height: 125,
        });
        this.measureChart = chart;
      }else{
        measureChartDv = new DataSet.DataView().source(this.allMeasure);
        chart = new Chart({
          container: "measure1",
          autoFit: true,
          height: 125,
        });
        this.measureChart1 = chart;
      }
      measureChartDv.transform({
        type: "fold",
        fields: ["昨日", "今日"], // 展开字段集
        key: "type", // key字段
        value: "value", // value字段
      });
      chart.data(measureChartDv.rows);
      chart.scale("time", {
        range: [0, 1],
      });
      chart.scale("value", {
        nice: true,
      });
      chart.axis("time", {
        tickLine: null,
        label: {
          formatter: function (value) {
            // let _time = Number(value.replace(/-/g,""));
            // console.log(_time)
            if (value == "00:00") {
              return "00时";
            } else if (value == "02:00") {
              return "02时";
            } else if (value == "04:00") {
              return "04时";
            } else if (value == "06:00") {
              return "06时";
            } else if (value == "08:00") {
              return "08时";
            } else if (value == "10:00") {
              return "10时";
            } else if (value == "12:00") {
              return "12时";
            } else if (value == "14:00") {
              return "14时";
            } else if (value == "16:00") {
              return "16时";
            } else if (value == "18:00") {
              return "18时";
            } else if (value == "20:00") {
              return "20时";
            } else if (value == "22:00") {
              return "22时";
            } else {
              return "";
            }
          },
          autoHide: false | true,
          autoRotate: false,
        },
      });
      chart.legend(false);
      chart.tooltip({
        shared: true,
        showCrosshairs: true,
      });
      chart
        .area()
        .position("time*value")
        .color("type", (type) => {
          if (type == "昨日") {
            return "#D1DDF6";
          } else if (type == "今日") {
            return "#5A8BEE";
          }
        })
        .shape("smooth");
      chart
        .line()
        .position("time*value")
        .color("type", (type) => {
          if (type == "昨日") {
            return "#D1DDF6";
          } else if (type == "今日") {
            return "#5A8BEE";
          }
        })
        .shape("smooth")
        .size(1);
      chart.render();
    },
    // 复制
    copyName() {
      var _this = this;
      this.$copyText(_this.competeInfo.compete_publisher_name).then(
        function (e) {
          _this.$refs.head.globalTip(2, "复制成功", 0);
          // console.log(e);
        },
        function (e) {
          _this.$refs.head.globalTip(1, "复制失败", 0);
          // console.log(e);
        }
      );
    },
    // 定时刷新数据函数
    dataRefreh() {
      // 计时器正在进行中，退出函数
      if (this.intervalId != null) {
        return;
      }
      // 计时器为空，操作
      this.intervalId = setInterval(() => {
        this.getMeasureData(); //加载数据函数
      }, 60000);
    },
    // 停止定时器
    clear() {
      clearInterval(this.intervalId); //清除计时器
      this.intervalId = null; //设置为null
    },
    // 进入页面渲染
    initPage() {
      this.getData();
      this.getRankData();
      this.getCompeteData();
      this.getMeasureData();
      this.getStockData();
      this.getIndustryData();
      // 判断是否显示更新记录
      let recordInfo = this.$refs.head.accountInfo.last_version
        ? this.$refs.head.accountInfo.last_version
        : {};
      let localRecordInfo = JSON.parse(localStorage.getItem("recordInfo"))
        ? JSON.parse(localStorage.getItem("recordInfo"))
        : [];
      if (recordInfo && Object.keys(recordInfo).length > 0) {
        this.recordObj = this.$refs.head.accountInfo.last_version;
        this.recordObj.version_desc = this.recordObj.version_desc.replace(
          /[\r\n]/g,
          "</br>"
        );
      }
      let _include = [],_date = '';
      if (Object.keys(recordInfo).length > 0) {
        if (Object.keys(localRecordInfo).length > 0) {
          localRecordInfo.map((value,key)=>{
            _include.push(value.userID);
            if(value.userID == Number(localStorage.getItem("userID"))){
              _date = value.enable_date;
            }
          })
          if (_include.includes(Number(localStorage.getItem("userID")))) {
            if (_date < recordInfo.enable_date) {
              this.recordModal = true;
            } else {
              this.recordModal = false;
            }
          } else {
            this.recordModal = true;
          }
        } else {
          this.recordModal = true;
        }
      } else {
        this.recordModal = false;
      }
    },
    noInitPage() {
      this.isLoading = false;
    },
    // 更新记录
    updateRecord() {
      this.recordModal = false;
      let localRecordInfo = JSON.parse(localStorage.getItem("recordInfo"))
        ? JSON.parse(localStorage.getItem("recordInfo"))
        : [];
      let _obj = this.$refs.head.accountInfo.last_version;
      _obj.userID = this.$refs.head.accountInfo.user_id;
      localRecordInfo = localRecordInfo.filter((value,key)=>{
        return value.userID !== _obj.userID;
      })
      localRecordInfo.push(_obj);
      localStorage.setItem("recordInfo", JSON.stringify(localRecordInfo));
    },
    // 头部切换机构触发
    publisherChange() {
      this.isLoading = true;
      this.getData();
      this.getRankData();
      this.getCompeteData();
      this.getMeasureData();
      this.getStockData();
      this.getIndustryData();
    },
  },
};
</script>
